package com.org.daniel.framework.config;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Daniel
 */
@Configuration
public class JsonResponseConfiguration {

	/**
	 * 接口中，自动转换的有：驼峰转换为下划线，空值输出null
	 */
//	@Bean
//	public Jackson2ObjectMapperBuilderCustomizer customizerJackson(){
//		return jacksonObjectMapperBuilder -> {
//			jacksonObjectMapperBuilder.serializationInclusion(JsonInclude.Include.NON_NULL);
//			jacksonObjectMapperBuilder.failOnUnknownProperties(false);
//			jacksonObjectMapperBuilder.propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
//		};
//		return new Jackson2ObjectMapperBuilderCustomizer() {
//			@Override
//			public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
//				jacksonObjectMapperBuilder.serializationInclusion(JsonInclude.Include.NON_NULL);
//				jacksonObjectMapperBuilder.failOnUnknownProperties(false);
//				jacksonObjectMapperBuilder.propertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
//			}
//		};
//	}

}
